﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SponsorshipManager.Client;
using System.Windows;
using System.ComponentModel;
using SponsorshipManager.Client.Model;
using SponsorshipManager.Interfaces; 


namespace SponsorshipManager.Client.ViewModel
{
    public class MainWindow : INotifyPropertyChanged  
    {

        public MainWindow()
        {
            User.ChangedCurrentUser += CurrentUserChanged;
        }
        

        public string Username
        {
            get
            {
                return (User.CurrentUser!=null) ?  User.CurrentUser.Username : String.Empty ;
            }
            set
            {

                PropertyChanged(this, new PropertyChangedEventArgs("Username"));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void CurrentUserChanged(IUser CurrentUser)
        {
            Username = CurrentUser.Username;

        }

    }
}
